//package com.sunop.pantiai.tools;
//
//import lombok.Data;
//import org.springframework.ai.model.function.FunctionCallback;
//import org.springframework.ai.model.function.FunctionCallbackWrapper;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.parsing.Problem;
//import org.springframework.context.annotation.Bean;
//import org.springframework.stereotype.Component;
//import java.util.List;
//import java.util.function.Function;
//
//@Component
//public class ProblemFunction implements Function<ProblemFunction.ProblemRequest, ProblemFunction.ProblemResponse> {
//
//    @Autowired
//    private ProblemService problemService;
//    @Override
//    public ProblemResponse apply(ProblemRequest request) {
//        List<Problem> problems = problemService.getProblemsByAI(request.difficulty, request.tag);
//        return new ProblemResponse(problems);
//    }
//
//
//
//    @Bean
//    public FunctionCallback problemFunctionCallback(ProblemFunction problemFunction) {
//        return FunctionCallbackWrapper.builder(problemFunction)
//                .withName("getProblems")
//                .withDescription("根据难度和标签获取编程题目列表")
//                .withInputType(ProblemRequest.class)
//                .build();
//    }
//
//    @Data
//    public static class ProblemRequest {
//        private Integer difficulty; // 0简单、1中等、2困难
//        private String tag; // 可空，如"数组"或"数组,哈希表"
//    }
//
//    @Data
//    public static class ProblemResponse {
//        private List<Problem> problems;
//
//        public ProblemResponse(List<Problem> problems) {
//            this.problems = problems;
//        }
//    }
//}